<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="hmg.common.CommonUtils"%>
<%@ page import="able.com.vo.SearchVO"%>
<%@ page import="hmg.vo.BoardVO"%>
<%@ page import="java.util.List"%>
<%--
    JSP Name : jspName.jsp
    Description : 설명을 기술합니다.
    author Kim hyung soo
    since 2012. 8. 21.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 8. 21.     Kim hyung soo     최초 생성
--%>
<%
    List<BoardVO> appList = (List<BoardVO>) request.getAttribute("AppList");
    Integer totalApps = (Integer) request.getAttribute("TotalApps");

    String currPage = CommonUtils.getParameter(request.getParameter("page"), "1");
    String searchCondition = CommonUtils.getParameter(request.getParameter("searchCondition"), "1");
    String searchKeyword = CommonUtils.getDecodedParameter(request.getParameter("searchKeyword"), "");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>APP : SNS/APP | 현대자동차그룹</title>
<meta name="description" content="현대자동차그룹 및 계열사별 APP(Application) 안내" />
<meta name="keywords" content="현대자동차그룹 APP, 현대차그룹 APP, APP, Application, 앱, 어플리케이션" />
<%@ include file="/WEB-INF/jsp/web/kor/include/header.jspf" %>
<script type="text/javascript">
//<![CDATA[
var page = "<%= currPage %>";

$(document).ready(function(){
    if (page == "")
        page = "1";

    $("#paging").html(getNewsPagingString(<%= totalApps %>, page, 5, 10));

});

function fn_list_search() {
    var condition = $("#searchCondition").val();
    var keyword = $("#searchKeyword").val();

    if (keyword.length < 2) {
        alert("검색어를 2자 이상 입력해 주세요.");
        return;
    }

    keyword = escape(encodeURIComponent(keyword));

    document.location.href = "./AppView.do?searchCondition=" + condition + "&searchKeyword=" + keyword + "&page=1";
}

function fn_move_page(pageNo){
    fn_common_move_page(pageNo, location.search, page, 5, <%= totalApps %>, "./AppView.do");
}

//]]>
</script>
</head>
<body>
    <!--wrap-->
    <div id="wrap">
        <!-- skip navigation -->
        <div id="skipnavition">
            <a href="#gnb">메뉴바로가기</a><a href="#content">본문바로가기</a>
        </div>
        <!--// skip navigation -->

        <hr />

        <!-- header-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/left.jspf" %>
        <!--//header-->

        <hr />

        <!--container-->
        <div id="container">
            <div class="scroll-pane">
                <!-- 공통 -->
                <div class="subTitle">
                    <div class="pageTitle">
                        <h2><img src="/hmg/images/web/kor/title/group_News_APP.gif" alt="APP" /></h2>
                        <p class="subCopy"><img src="/hmg/images/web/kor/title/group_News_APP_desc.gif" alt="다양하게 즐기는 애플리케이션소개" /></p>
                    </div>

                    <div class="pageLocation">
                        <ul>
                            <li><a href="/hmg/web/kor/Main.do"><img src="/hmg/images/web/kor/common/location_home.gif" alt="홈"/></a></li>
                            <li><a href="/hmg/web/kor/grn/GroupNewsSubMain.do">그룹소식</a></li>
                            <li><a href="/hmg/web/kor/grn/sns/SnsView.do">SNS/APP</a></li>
                            <li class="nowPage"><a href="/hmg/web/kor/grn/sns/AppView.do">APP</a></li>
                        </ul>
                    </div>
                </div>
                <!--//공통-->

                <!--contents-->
                <div id="content">
                    <!-- 내용 -->
                    <div class="groupNews">
<%
    if (appList == null || appList.size() == 0){
        out.println("                       <div class=\"App_Thumb_List\">");
        out.println("                           <dl style=\"text-align:center;\">등록된 게시물이 없습니다.</dl>");
        out.println("                       </div>");
    }
    else {
        for (int idx = 0; idx < appList.size(); idx++) {
            BoardVO app = appList.get(idx);

            if (idx + 1 < appList.size())
                out.println("                           <div class=\"App_Thumb_List\">");
            else
                out.println("                           <div class=\"App_Thumb_List last\">");
%>
                            <dl>
                                <dt><%= app.getTitle() %></dt>
                                <dd class="text"><%= CommonUtils.getPlainText(app.getWebContent(), true, 300) %><br></br></dd>
                                <dd class="btn">
<%          if (app.getLink1() != null) { %>
                                    <a href="<%= app.getLink1() %>" title="<%= app.getTitle() %>" target="_BLANK"><img src="/hmg/images/web/kor/btn/btn_ios.gif" alt="iOS" /></a>
<%
            }
            if (app.getLink2() != null) {
%>
                                    <a href="<%= app.getLink2() %>" target="_BLANK"><img src="/hmg/images/web/kor/btn/btn_android.gif" alt="Android" /></a>
<%
            }
            if (app.getLink1() == null && app.getLink2() == null) {
%>
                                    <br /><br />
<%          } %>
                                </dd>
                            </dl>
                            <p class="img"><img src="<%= app.getThumbnailImage() %>" alt="" /></p>
                        </div>
<%
        }
    }
%>

                        <div class="gropnews_page">
                            <div class="gropnews_page_left">
                                <ul id="paging"></ul>
                            </div>
                            <div class="gropnews_page_right">
                                <ul>
                                    <li><a href="javascript:fn_move_page('prev');"><img src="/hmg/images/web/kor/btn/btn_prev.gif" alt="이전페이지로 이동" /></a></li>
                                    <li><a href="javascript:fn_move_page('next');"><img src="/hmg/images/web/kor/btn/btn_next.gif" alt="다음페이지로 이동" /></a></li>
                                </ul>
                            </div>
                        </div>

                        <!-- searcharea-->
                        <div class="searchArea">
                            <img src="/hmg/images/web/kor/grn/groupnews_Search_Text01.gif" alt="상세검색" class="search_text"/>
                            <label class="hidden" for="">검색 영역</label>
                            <select id="searchCondition">
                                <option value="1"<%= searchCondition.equals("1") == true ? " selected" : "" %>>제목</option>
                                <option value="2"<%= searchCondition.equals("2") == true ? " selected" : "" %>>내용</option>
                                <option value="3"<%= searchCondition.equals("3") == true ? " selected" : "" %>>제목 + 내용</option>
                            </select>
                            <label class="hidden" for="">검색</label>
                            <input type="text" id="searchKeyword" name="searchKeyword" value="<%= searchKeyword %>" title="검색" onkeypress="javascript:if (event.keyCode == 13) fn_list_search();" />
                            <a href="javascript:fn_list_search();"><img src="/hmg/images/web/kor/btn/btn_search.gif" alt="검색" class="search_btn"/></a>
                        </div>
                        <!--// searcharea-->
                    </div>
                    <!--// 내용 -->
                </div>
                <!--//contents-->
            </div>
        </div>
        <!--//container-->

        <hr />

        <!--footer-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/footer.jspf" %>
        <!--//footer-->

        <hr />

        <!--notice-->
        <%@ include file="/WEB-INF/jsp/web/kor/include/notice.jspf" %>
        <!--//notice-->
    </div>
    <!--//wrap-->
</body>
</html>